package com.bawei.module_open.qi.view

import android.content.Context
import android.opengl.GLSurfaceView
import android.util.AttributeSet
import android.util.Log


class SquareGLSurfaceView(context: Context?, attrs: AttributeSet?) :
    GLSurfaceView(context, attrs) {
    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec)

        val width = MeasureSpec.getSize(widthMeasureSpec)
        val height = MeasureSpec.getSize(heightMeasureSpec)

        Log.i(
            TAG,
            "specify width mode:" + MeasureSpec.toString(widthMeasureSpec) + " size:" + width
        )
        Log.i(
            TAG,
            "specify height mode:" + MeasureSpec.toString(heightMeasureSpec) + " size:" + height
        )

        setMeasuredDimension(width, width)
    }

    companion object {
        private const val TAG = "SquareGLSurfaceView"
    }
}